package Practice.ooday04;

public class Test {

    public static void main(String[] args) {

Master master = new Master();

        /*Animal dog = new Dog("大黄", 1, "黄色");
        Animal fish =new Fish("小鲤鱼",1,"红色");
        Animal chick = new Chick("鸡仔",1,"橘黄色");*/
        Animal[] animal = new Animal[3];
        animal[0] = new Dog("大黄", 1, "黄色");
        animal[1] = new Fish("小鲤鱼", 1, "红色");
        animal[2] = new Chick("鸡仔", 1, "橘黄色");
        master.feed(animal[0]);
        master.feed(animal[1]);
        master.feed(animal[2]);
        for (int i = 0; i < animal.length ; i++) {
            System.out.println(animal[i].name);
            animal[i].eat();
            if(animal[i] instanceof Swim){
                Swim Animal = (Swim) animal[i];
                Animal.swim();
            }
            if (animal[i] instanceof Chick){
                Chick chick = (Chick) animal[i];
                chick.layEgg();
            }
        }


    }



}
